/* *******************************************************************************
 *      Copyright:  (C) 2025 ZYT
 *                  All rights reserved.
 *
 *       Filename:  sqlite.h
 *    Description:  This file 
 *
 *        Version:  1.0.0(30/03/25)
 *         Author:  Zhang yuting <zhangyuting@163.com>
 *      ChangeLog:  1, Release initial version on "30/03/25 16:14:51"
 *                
 *********************************************************************************/

#ifndef _SQLITE_H_
#define _SQLITE_H_

#include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "logger.h"
#include "pack.h"

#define CONFIG_DEBUG
#ifdef CONFIG_DEBUG
#define dbg_printf(format, args...) printf(format, ##args)
#else
#define dbg_printf(format, args...) do{} while(0)
#endif

int sql_init(sqlite3 **db, const char *table_name);
int sql_delete(sqlite3 *db, char *statement_name);
int sql_insert(sqlite3 *db,char *statement_name, packet_t *pack);
int sql_check(sqlite3 *db, char *statement_name);
int sql_write_to_server(sqlite3 *db, int sockfd, char *statement_name);
int sql_close(sqlite3 **db);


static int callback_check(void *data, int argc, char **argv, char **azColName);
static int callback_write(void *data, int argc, char **argv, char **azColName);


#endif

